package com.chaochis.wind.novel.web;

import com.chaochis.wind.config.api.ApiResult;
import com.chaochis.wind.config.page_config.NeedPageHelper;
import com.chaochis.wind.novel.service.WindNovelService;
import com.chaochis.wind.novel.vo.WindNovel;
import com.chaochis.wind.novel.params.WindNovelQueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/novel")
public class WindNovelController {

  @Autowired
  private WindNovelService windNovelService;


  @GetMapping("/getList")
  @NeedPageHelper
  public ApiResult<List<WindNovel>> getList(WindNovelQueryVo windNovelQueryVo) {
    var windNovelVo = new WindNovel();
    windNovelVo.setCusCreateByUser(windNovelQueryVo.getAuthorName());
    windNovelVo.setNovelName(windNovelQueryVo.getNovelName());
    return ApiResult.success(this.windNovelService.getNovelList(windNovelVo));
  }
}
